package com.wing.order.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 出库单计划
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_inventory_out_plan")
public class InventoryOutPlan extends BaseEntity<InventoryOutPlan> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 待确认
        */
        confirmed(0,"待审核"),
        /**
        * 已确认
        */
        confirm(1,"已审核"),
        /**
        * 已完成
        */
        fulfill(2,"已完成");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 出库单编号
     */
    private String code;

    /**
     * day
     */
    private Integer day;

    /**
     * no
     */
    private Integer no;

    /**
     * 出入库类型id
     */
    private Long inoutTypeId;

    /**
     * 发货仓库id
     */
    private Long outWarehouseId;

    /**
    * 发货时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendTime;

    /**
     * 目标仓库id
     */
    private Long inWarehouseId;

    /**
     * 发货人
     */
    private String consigner;

    /**
     * 上货计划ID
     */
    private Long cabinetLoadPlanId;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }
    /**
     * 目标仓库名称
     */
    private String inWarehouseName;

    /**
     * 目标仓库库区
     */
    private String inAreaName;
    @TableField(exist = false)
    /**
     * 出库商品数
     */
    private Integer quantityTotal;
    /**
     * 总供货金额
     */
    @TableField(exist = false)
    private BigDecimal supplyAmount;
    /**
     * 出库商品市场总价
     */
    @TableField(exist = false)
    private BigDecimal marketAmount;
    @TableField(exist = false)
    private BigDecimal totalMoney;
    @TableField(exist = false)
    private BigDecimal bazaarTotalMoney;
    private String remark;
    /**
     * 出库仓
     */
    @TableField(exist = false)
    private String outWarehouseName;
    @TableField(exist = false)
    /**
     * 收货所在地
     */
    private String areaName;
    @TableField(exist = false)
    private String timeInterval;
    @TableField(exist = false)
    private String productName;
    /**
     * 所属出库计划
     */
    @TableField(exist = false)
    private String planCode;
    @TableField(exist = false)
    private Long planId;
    /**
     * 收货人
     */
    @TableField(exist = false)
    private String customerConcat;

    /**
     * 计划出库类型名称
     */
    @TableField(exist = false)
    private String inoutTypeName;
    /**
     * 计划出库类型code
     */
    private String inoutTypeCode;
    /**
     * 刀柜名称
     */
    @TableField(exist = false)
    private String cabinetName;

    /**
     * 柜子id
     */
    private Long cabId;
    @TableField(exist = false)
    private String startCreateTime;
    @TableField(exist = false)
    private String endCreateTime;

    /**
     * 交付计划id
     */
    private Long selDeliveryId;

    /**
     * 目标仓的省
     */
    private Long province;
    /**
     * 目标仓的市
     */
    private Long city;
}
